<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>CSS Test: An animation's events with 0 duration and 'animation-fill-mode'</title>
        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
        <link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-behavior-" />
        <meta name="flags" content="animated dom" />
        <meta name="assert" content="An animation with 0 duration and 'animation-fill-mode' set fires events" />
        <style type="text/css">
            @keyframes testAnimation
            {
                from {opacity: 0;}
                to {opacity: 1;}
            }
            #testDiv
            {
                animation-duration: 1s;
                animation-iteration-count: 2;
                background-color: blue;
                height: 50px;
                width: 50px;
            }
            #fail
            {
                background: red;
            }
        </style>
        <script type="text/javascript">
            var element;

            function startTest()
            {
            
                document.body.offsetWidth;
                element = document.getElementById("testDiv");
            
            
                element.addEventListener('AnimationIteration', passTest, true);
                element.style["animation-name"] = "testAnimation";
            }
            
            function passTest()
            {
            alert("here");
                var failElement = document.getElementById("fail");
                failElement.style.display = "none";
            }
        </script>
    </head>
    <body onload="startTest()">
        <p>Test passes if there is no red on the page.</p>
        <div id="fail">FAIL</div>
        <div id="testDiv"></div>
    </body>
</html>
